// @ts-ignore
/* eslint-disable */
import { request } from 'umi';

/** 获取组织机构树 GET /api/organization/tree */
export async function getApiOrganizationTree(
  params: {
    // query
    parentid?: string;
  },
  options?: { [key: string]: any },
) {
  return request<API.SimpleResultListOrgDto>('/api/organization/tree', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 获取组织机构详情 GET /api/organization/detail/${param0} */
export async function getApiOrganizationDetailById(
  params: {
    // path
    id: string;
  },
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.SimpleResultOrgDetailDto>(`/api/organization/detail/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 创建组织机构 POST /api/organization */
export async function postApiOrganization(
  body: API.OrgCreateAndUpdateDto,
  options?: { [key: string]: any },
) {
  return request<API.SimpleResultListOrgDto>('/api/organization', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 更新组织机构信息 PUT /api/organization/${param0} */
export async function putApiOrganizationById(
  params: {
    // path
    id: string;
  },
  body: API.OrgCreateAndUpdateDto,
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.SimpleResultListOrgDto>(`/api/organization/${param0}`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 删除组织机构,该操作会删除包含的下级数据 DELETE /api/organization/${param0} */
export async function deleteApiOrganizationById(
  params: {
    // path
    id: string;
  },
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.SimpleResultListOrgDto>(`/api/organization/${param0}`, {
    method: 'DELETE',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 更新组织机构的层级与排序并返回最新数据 PATCH /api/organization/${param0}/tree/${param1} */
export async function patchApiOrganizationByIdTreeByChangeid(
  params: {
    // query
    /** 传入Antd Tree 拖动事件的 dropToGap 值 */
    droptogap?: boolean;
    // path
    /** 操作id */
    id: string;
    /** 变更id */
    changeid: string;
  },
  options?: { [key: string]: any },
) {
  const { id: param0, changeid: param1, ...queryParams } = params;
  return request<API.SimpleResultListOrgDto>(`/api/organization/${param0}/tree/${param1}`, {
    method: 'PATCH',
    params: {
      ...queryParams,
    },
    ...(options || {}),
  });
}

/** 获取指定机构的成员 GET /api/organization/${param0}/users */
export async function getApiOrganizationByIdUsers(
  params: {
    // path
    id: string;
  },
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.SimpleResultListUserDto>(`/api/organization/${param0}/users`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 更新机构关联用户 PUT /api/organization/${param0}/users */
export async function putApiOrganizationByIdUsers(
  params: {
    // path
    id: string;
  },
  body: number[],
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/api/organization/${param0}/users`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 删除机构关联用户 DELETE /api/organization/${param0}/users */
export async function deleteApiOrganizationByIdUsers(
  params: {
    // path
    id: string;
  },
  body: number[],
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/api/organization/${param0}/users`, {
    method: 'DELETE',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 获取指定机构的角色 GET /api/organization/${param0}/roles */
export async function getApiOrganizationByIdRoles(
  params: {
    // path
    id: string;
  },
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.SimpleResultListRoleDto>(`/api/organization/${param0}/roles`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 更新机构关联角色 PUT /api/organization/${param0}/roles */
export async function putApiOrganizationByIdRoles(
  params: {
    // path
    id: string;
  },
  body: number[],
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/api/organization/${param0}/roles`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 删除机构关联角色 DELETE /api/organization/${param0}/roles */
export async function deleteApiOrganizationByIdRoles(
  params: {
    // path
    id: string;
  },
  body: number[],
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/api/organization/${param0}/roles`, {
    method: 'DELETE',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}
